]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: focus windows on Escape key press
authorStefano Facchini <stefano.facchini@gmail.com>
Wed, 1 Nov 2017 18:43:11 +0000 (19:43 +0100)
committerStefano Facchini <stefano.facchini@gmail.com>
Wed, 1 Nov 2017 19:52:58 +0000 (20:52 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=671121

js/ui/panel.js

index e90d65beb9560b2100aede4112f6bec4923d708b..d9b1a32efec18ac4edc9de34a4280a1a8c7c687c 100644 (file)
@@ -797,6 +797,7 @@ var Panel = new Lang.Class({
         this.actor.connect('get-preferred-height', Lang.bind(this, this._getPreferredHeight));
         this.actor.connect('allocate', Lang.bind(this, this._allocate));
         this.actor.connect('button-press-event', Lang.bind(this, this._onButtonPress));
+        this.actor.connect('key-press-event', Lang.bind(this, this._onKeyPress));
 
         Main.overview.connect('showing', Lang.bind(this, function () {
             this.actor.add_style_pseudo_class('overview');
@@ -964,6 +965,16 @@ var Panel = new Lang.Class({
         return Clutter.EVENT_STOP;
     },
 
+    _onKeyPress: function(actor, event) {
+        let symbol = event.get_key_symbol();
+        if (symbol == Clutter.KEY_Escape) {
+            global.screen.focus_default_window(event.get_time());
+            return Clutter.EVENT_STOP;
+        }
+
+        return Clutter.EVENT_PROPAGATE;
+    },
+
     _toggleMenu: function(indicator) {
         if (!indicator) // menu not supported by current session mode
             return;